package br.unesp.demac.ccn07.aula3.ex5;

import java.util.Random;
import java.util.Scanner;

public class Vetor {

	public static void main(String[] args) {
		
		Scanner read = new Scanner(System.in);
		System.out.printf("Entre com a quantidade de items: ");
		Integer arraySize = read.nextInt();
		
		Integer[] array = new Integer[arraySize];
		
		Random rand = new Random();
		
		for(int i = 0; i < arraySize; i++)
			array[i] = rand.nextInt(201) - 100;
		
		Integer maior = new Integer(0);
		Integer menor = new Integer(100);
		Double media = new Double(0);
		
		for(int n : array) {
			if (n > maior) maior = n;
			if (n < menor) menor = n;
			media += n;
			//System.out.printf("%d\t", n);
		}
		
		media = media / arraySize;
		
		System.out.printf(
				"Media:\t%f\n" +
				"Maior:\t%d\n" +
				"Menor:\t%d\n",
				media, maior, menor);

	}

}
